package com.zzf;

import com.zzf.rpc.IGpHelloService;
import com.zzf.rpc.RpcClientProxy;

import java.net.MalformedURLException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

/**
 * @author zzf
 * @date 2018/8/13 17:35.
 */
public class RpcClientDemo {

    public static void main(String[] args) throws RemoteException, NotBoundException, MalformedURLException {
        RpcClientProxy rpcClientProxy=new RpcClientProxy();

        IGpHelloService hello=rpcClientProxy.clientProxy
                (IGpHelloService.class,"localhost",8888);
        System.out.println(hello.sayHello("mic"));
//        IGpHelloService helloService=
//                (IGpHelloService) Naming.lookup("rmi://127.0.0.1:8888/sayHello");
//        // HelloServiceImpl实例(HelloServiceImpl_stub)
//        // RegistryImpl_stub
//        System.out.println(helloService.sayHello("Mic"));
    }
}
